<?php
include('function/connection.php');
?>
			<table width="700" border="1" align="center" >
				<tr>
                <td width="10%" align="left"><strong>Date</strong></td>
                <td width="10%" align="left"><strong>Customer</strong></td>
                <td width="25%" align="left"><strong>Product </strong></td>
                <td width="5%" align="left"><strong>Qty </strong></td>
                <td width="10%" align="center"><strong>Rate</strong></td>
                <td width="10%"align="center"><strong>Total</strong></td>
              </tr>
<?php 
			  	$sql="SELECT * FROM tbl_sales  ";
				$result=mysql_query($sql);
				$sale_id="";
				while ($line = mysql_fetch_object($result)) {
?>
				<tr>
                	<td colspan="6">
						<?php
                            if($sale_id!= $line->sale_id) { 
                                echo $line->sale_id."<br>"; 
								echo $line->amount."<br>"; 
                                $sale_id = $line->sale_id; 
                            } 
                        ?>
                   </td>
                </tr>
				<tr>
                <td align="left"><?php  $mysqldate=$line->sale_date;
 		$phpdate = strtotime( $mysqldate );
 		$phpdate = date("d/m/Y",$phpdate);
		echo $phpdate; ?></td>
        		<td align="center"><?php echo $line->cus_name; ?></td>
                <td ><?php echo $line->pd_name; ?></td>
                <td align="center"><?php echo $line->qty; ?></td>
                <td align="center"><?php echo $line->selling_price."$"; ?></td>
                <td align="center"><?php echo $line->total."$"; ?></td>
              </tr>
<?php

				}
?>
		</table>